package main

import "fmt"

func main() {
	m := map[string]string { // 无序的
		"name": "belic",
		"course": "golang",
		"site": "imooc",
		"quality": "notbad",
	}
	m2 := make(map[string]int)  // m3 == empty map
	var m3 map [string] int // m3 == nil
	fmt.Println(m, m2, m3)
	for k,v := range m{
		fmt.Println(k, v)
	}
	courseName, ok := m["course"]
	fmt.Println(courseName, ok)
	causeName := m["cause"]
	fmt.Println(causeName)
	if causeName, ok := m["cause"]; ok{
		fmt.Println(causeName)
	}else{
		fmt.Println("Key does not exist")
	}
	// 删除
	delete(m, "name")
}
